<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
<nav class="navbar navbar-default" th:fragment="nav">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">xx的博客</span>
            </button>
            <a class="navbar-brand" href="/">xx的博客</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="请输入要搜索的内容">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li th:if="${session.user != null} ">
                    <a href="/publish">发布</a>
                </li>
                <li th:if="${session.user != null}" class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" >
                        <span th:text="${session.user.getName()}"></span>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="/profile/questions">消息</a></li>
<!--                        <li><a href="#">个人资料</a></li>-->
                        <li><a href="/logout">退出</a></li>
                    </ul>
                </li>
                <li th:unless="${session.user != null}">
<!--                    <span th:text="${#httpServletRequest.getRequestURL()}"></span>-->
<!--                    <a th:href="@{https://github.com/login/oauth/authorize(client_id='bbf4b72f7bb2650a71fe',redirect_uri=${#request.getServerName()+#request.getServerPort()+'callback'},scope='user',state=1)}">登录</a>-->
                    <a th:href="@{https://github.com/login/oauth/authorize(client_id='bbf4b72f7bb2650a71fe',redirect_uri=${#httpServletRequest.getRequestURL()+'callback'},scope='user',state=1)}">登录</a>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
</body>